<template>
  <div>
    <div class="top1">
      <div class="dingdan">
        <van-icon name="arrow-left" @click="$router.push(`/close`)" />
        <span>订单备注</span>
        <span></span>
      </div>
    </div>
    <div class="baidi"></div>
    <div class="celerity">
      <p class="celerity-p">快速备注</p>
    </div>
    <div class="celeritybtn">
      <div>
        <el-radio-group @change="btn1" v-model="user.radio2" size="medium">
          <el-radio-button label="不要辣"></el-radio-button>
          <el-radio-button label="少点辣"></el-radio-button>
          <el-radio-button label="多点辣"></el-radio-button>
        </el-radio-group>
        <el-radio-group @change="btn1" v-model="user.radio3" size="medium">
          <el-radio-button label="不要香菜"></el-radio-button>
        </el-radio-group>
        <el-radio-group @change="btn1" v-model="user.radio4" size="medium">
          <el-radio-button label="不要洋葱"></el-radio-button>
        </el-radio-group>
        <el-radio-group @change="btn1" v-model="user.radio5" size="medium">
          <el-radio-button label="多点醋"></el-radio-button>
        </el-radio-group>
        <el-radio-group @change="btn1" v-model="user.radio6" size="medium">
          <el-radio-button label="多点葱"></el-radio-button>
        </el-radio-group>
        <el-radio-group @change="btn1" v-model="user.radio7" size="medium">
          <el-radio-button label="去冰"></el-radio-button>
          <el-radio-button label="少冰"></el-radio-button>
        </el-radio-group>
      </div>
    </div>
    <div class="baidi"></div>
    <div class="qitai">
      <div class="qitai1">其他备注</div>
      <textarea
        placeholder="请输入备注内容（可不填）"
        cols="30"
        rows="10"
        v-model="text"
      ></textarea>
    </div>
    <van-button @click="btn3" type="primary" block>确认</van-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      user: {
        radio2: "",
        radio3: "",
        radio4: "",
        radio5: "",
        radio6: "",
        radio7: "",
      },

      constn: "",
      text: "",
    };
  },
  methods: {
    btn1(Radio) {
      localStorage.removeItem("bezhu");
    },
    btn3() {
      console.log(this.user);
      let a = "";
      for (const key in this.user) {
        console.log(this.user[key]);
        if (this.user[key]) {
          a += this.user[key] + ",";
        }
      }

      if (a) {
        a = a + this.text;
        console.log(a);
        localStorage.setItem("bezhu", a);
        this.$message({
          message: "你以成功修改",
          type: "success",
        });
      } else {
        this.$message({
          message: "你还没有设置备注哟",
          type: "warning",
        });
      }
      this.$router.push(`/close`);
    },
  },
};
</script>
   
<style lang="less" scoped>
.van-button {
  margin-left: 20px;
  width: 90%;
}
textarea {
  padding: 15px;
  width: 306px;
  height: 100px;
  border: none;
  background-color: #f9f9f9;
  border-radius: 7px;
}
.qitai {
  height: 196px;
  padding: 0 20px;
  background-color: #ffffff;
  .qitai1 {
    height: 40px;
    line-height: 40px;
  }
}
.celerity,
.celeritybtn {
  background-color: #ffffff;
}
.el-radio-group {
  margin-left: 10px;
  margin-top: 10px;
}
.celeritybtn {
  display: flex;
  height: 159px;
}
.celeritybtnleft4 {
  height: 50px;
  width: 110px;
  display: inline-block;
  line-height: 50px;
  text-align: center;
  border-radius: 8px;
  border: 1px solid #3190e8;
  margin-left: 30px;
}
.celeritybtnleft1 {
  height: 50px;
  width: 110px;
  display: inline-block;
  line-height: 50px;
  text-align: center;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  border: 1px solid #3190e8;
}
.celeritybtnleft2 {
  height: 50px;
  width: 110px;
  display: inline-block;
  line-height: 50px;
  text-align: center;
  border: 1px solid #3190e8;
}
.celeritybtnleft3 {
  height: 50px;
  width: 110px;
  display: inline-block;
  line-height: 50px;
  text-align: center;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  border: 1px solid #3190e8;
}
.celerity-p {
  height: 75px;

  line-height: 75px;
  padding: 0 25px;
  font-size: 18px;
}
.dingdan {
  height: 60px;
  background-color: #3190e8;
  display: flex;
  line-height: 60px;
  justify-content: space-between;
  padding: 0 15px;
  .van-icon {
    margin-top: 15px;
  }
  span,
  .van-icon {
    font-size: 25px;
    color: cornsilk;
  }
}
.baidi {
  height: 20px;
  background-color: #f5f5f5;
}
</style>